home *** CD-ROM | disk | FTP | other *** search
/ Delphi Magazine Collection 2001 / Delphi Magazine Collection 20001 (2001).iso / DISKS / Issue46 / packages / CoreAppPackage / BaseFormU.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1999-04-22  |  1.0 KB  |  57 lines

  1. unit BaseFormU;
  2.  
  3. interface
  4.  
  5. uses
  6.   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  7.   ExtCtrls, StdCtrls;
  8.  
  9. type
  10.   TBaseForm = class(TForm)
  11.     Label1: TLabel;
  12.     BtnOK: TButton;
  13.     Timer1: TTimer;
  14.     procedure Timer1Timer(Sender: TObject);
  15.     procedure BtnOKClick(Sender: TObject);
  16.   private
  17.     { Private declarations }
  18.   public
  19.     { Public declarations }
  20.   end;
  21.  
  22.   TBaseFormClass = class of TBaseForm;
  23.  
  24. var
  25.   BaseForm: TBaseForm;
  26.   BaseFormClass: TBaseFormClass = TBaseForm;
  27.  
  28. implementation
  29.  
  30. {$R *.DFM}
  31.  
  32. procedure TBaseForm.Timer1Timer(Sender: TObject);
  33. const
  34.   Offset: Shortint = 5;
  35.   Limit = 16;
  36. begin
  37.   BtnOK.Left := BtnOK.Left + Offset;
  38.   if BtnOK.Left + BtnOK.Width >= ClientWidth - Limit then
  39.   begin
  40.     Offset := Offset * -1;
  41.     BtnOK.Left := ClientWidth - BtnOK.Width - Limit
  42.   end
  43.   else
  44.   if BtnOK.Left <= Limit then
  45.   begin
  46.     Offset := Offset * -1;
  47.     BtnOK.Left := Limit
  48.   end
  49. end;
  50.  
  51. procedure TBaseForm.BtnOKClick(Sender: TObject);
  52. begin
  53.   Close
  54. end;
  55.  
  56. end.
  57.